/**
 * @file    drv_clock.c
 * @author  yhy
 * @brief   芯必达IM94x系列芯片, 时钟抽象层
 * @version 1.01
 * @date    2025-07-07
 *
 * @copyright Copyright (c) 2025
 *
 * @details
 * Change Logs:
 * Date           Author       Notes
 * 2025-07-04     yhy          the first version V1.00
 * 2025-07-11     yhy          所有函数和变量名修改为snf_开头 V1.01
 */
#include "drv_clock.h"

#include "clock_drv.h"
#include "os_adapter.h"

/**
 * @brief   初始化时钟, 系统时钟为120MHz
 * @details 系统时钟为120MHz, APB时钟为60MHz, PERIO为30MHz, PERI1为24MHz
 *
 */
void snf_drv_clock_init(void)
{
    clock_config_t clockConfig;

    /* Initial clock, system clock = 120MHz, APB Clock = 60MHz */
    CLOCK_GetDefaultConfig(&clockConfig, PLL_IN_8M, PLL_OUT_120M);
    (void)CLOCK_Init(&clockConfig);

    /* PERI0 2 分频, 30MHz */
    CLOCK_SetMainClockPrescaler(CLK_PERI0, PERI0_CLK_PRESCALER_2);

    /* PERI1 24MHz */

    /* SysTick初始化 */
    OS_Adapter_Init(NULL);
}
